<template>
  <div class="home">
      <el-header><span class="qqq">电商后台管理系统</span><button @click="tc" class="tc">退出</button></el-header>
  <el-container>
    <el-aside width="200px">
          <el-menu
            default-active="2"
            class="el-menu-vertical-demo"
            background-color="#545c64"
            text-color="#fff"
            active-text-color="#ffd04b"
            router
          >
            <el-submenu :index="item.path" v-for="item in lb" :key="item.id">
              <template slot="title">
                <i class="el-icon-location"></i>
                <span>{{item.authName}}</span>
              </template>
              <el-menu-item-group v-for="ele in item.children" :key="ele.id">
                  <el-menu-item :index="ele.path">{{ele.authName}}</el-menu-item>
              </el-menu-item-group>
            </el-submenu>
            
          </el-menu>
        </el-aside>
    <el-main><router-view></router-view></el-main>
  </el-container>
  </div>
</template>
<script>
export default {
  data() {
    return {
      lb: [],
    }
  },
  created() {
    this.$axios.get("menus").then((res) => {
      // console.log(res);
      this.lb = res.data.data;
    });
    
  },
  methods: {
    tc() {
      this.$router.push({ path: "/login" });
    },
  },
}
</script>
<style lang="scss" scoped>
.el-header, .el-footer {
    background-color:#3b3f41;
    color: #333;
    text-align: center;
    line-height: 60px;
  }
  
  .el-aside {
    background-color: #3b3c49;
    color: #333;
    text-align: center;
    height: 600px;
  }
  
  .el-main {
    background-color: #E9EEF3;
    color: #333;
    text-align: center;
    height: 600px;
  }
  
  body > .el-container {
    margin-bottom: 40px;
  }
  .qqq{
    color: #fff;
    float: left;
    font-size: 20px;
  }
  .tc{
    float: right;
    margin-top: 15px;
    margin-right: 30px;
  }
</style>